<template>
	<view class="scenic-detail-container mainbgc" v-show="show">
		<u-swiper :list="dataAll.images_text" height="300" radius="0"></u-swiper>
		<!-- <view class="detail-bg">
			<image src="../../static/images/scenic/detail-bg.png" mode=""></image>
		</view> -->
		<view class="detail-content">
			<view class="mainpadding ffffff radius">
				<view class="title">{{dataAll.name}}</view>
				<view class="introduce margin-top">{{dataAll.content}}</view>
				<view class="address margin-top">
					<u-icon name="home"></u-icon>
					<text>{{dataAll.Area.province}}{{dataAll.Area.city}}{{dataAll.Area.region}}{{dataAll.detail}}</text>
					<view class="add-logo"  @click="openlocation">
						<image src="../../static/images/scenic/address.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="mainpadding margin-top ffffff" v-for="item in dataAll.tourtiket" :key="item.id"  @click="bookFn(item.id)">
				<view class="title">{{item.name}}</view>
				<view class="flexbetween margin-top">
					<view class="price">￥{{item.price}}</view>
					<view class="dingImg">
						<image src="../../static/images/scenic/ding.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid: "",
				dataAll:{},
				show:false,
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.init()
		},
		methods: {
			init() {
				httpRequest.request('api/tour/tourDetail', 'GET', {
					id: this.listid
				}, false, false, false).then(res => {
					this.show=true
					this.dataAll = res.data
				}).catch(err => {
					this.show=true
					httpRequest.toast(err.msg);
				})
			},
			openlocation(){
				uni.openLocation({
				     latitude: Number(this.dataAll.latitude),//即将传到高德或腾讯地图的终点纬度  必须是数值，字符串无效
				     longitude:Number(this.dataAll.longitude),//即将传到高德或腾讯地图的终点经度  必须是数值，字符串无效
				     name: this.dataAll.name,//即将传到高德或腾讯地图的店铺名称
				     address: this.dataAll.detail,//即将传到高德或腾讯地图的详细地址
				     scale: 18
				})
			},
			// 预定：
			bookFn(id) {
				if (!httpRequest.checkIsLogin()) {
				 httpRequest.doLogin();
				 return false;
				}else{
				uni.navigateTo({
					url: '/pages/scenic/yuding?id='+id
				 })
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.radius {
		border-radius: 35rpx 35rpx 0 0;
	}

	.detail-bg {
		width: 756rpx;
		height: 569rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.add-logo {
		width: 52rpx;
		height: 52rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}


	.detail-content {
		border-radius: 39rpx 39rpx 0rpx 0rpx;
		box-sizing: border-box;
		width: 100%;
		z-index: 999;
		position: relative;
		top: -100rpx;
	}

	.introduce {
		// padding: 30rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.address {
		display: flex;
		justify-content: space-between;
		align-items: center;
		// padding: 0 30rpx;

		text {
			flex: 1;
			margin-left: 7rpx;
			font-size: 24rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #333333;
		}
	}

	.title {
		font-size: 38rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #333333;
	}

	.price {
		font-size: 38rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FF5C00;
	}

	.dingImg {
		width: 77rpx;
		height: 76rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>
